package org.ouwh.fw.model.module;

import org.ouwh.fw.model.AbstractLoader;
import org.ouwh.fw.util.xml.Node;

public class ModuleLoader extends AbstractLoader {

	public ModuleLoader(Class<?> clazz) throws Exception {
		super("/" + clazz.getName().replaceAll("\\.", "/") + ".mdl");
	}

	public Object loadObjecFromNode(Node node) throws Exception {
		Class<?> cl = Class.forName(node.getXmlType());
		Object o = cl.newInstance();
		((Module) o).init(node);
		return o;
	}

}
